<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="/common/template :: header(~{::title},~{::link},~{::style})">
</head>
<body>
    <div class="layui-form timo-compile">
    <form th:action="@{/store/baseinfo/save}">
        <input type="hidden" name="id" th:if="${baseinfo}" th:value="${baseinfo.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">商家名称</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="store_name" placeholder="请输入商家名称" th:value="${baseinfo?.store_name}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商家电话</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="store_tel" placeholder="请输入商家电话" th:value="${baseinfo?.store_tel}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商家地址</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="address" placeholder="请输入商家地址" th:value="${baseinfo?.address}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">坐标</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="coordinates" placeholder="请输入坐标" th:value="${baseinfo?.coordinates}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">公告</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="announcement" placeholder="请输入公告" th:value="${baseinfo?.announcement}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">营业开始时间</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="start_time" placeholder="请输入营业开始时间" th:value="${baseinfo?.start_time}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">营业结束时间</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="endtime" placeholder="请输入营业结束时间" th:value="${baseinfo?.endtime}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">访问数</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="views" placeholder="请输入访问数" th:value="${baseinfo?.views}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">营业执照</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="yyzz_img" placeholder="请输入营业执照" th:value="${baseinfo?.yyzz_img}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="sfz_img" placeholder="请输入身份证" th:value="${baseinfo?.sfz_img}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">logo</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="logo" placeholder="请输入logo" th:value="${baseinfo?.logo}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">weixin_logo</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="weixin_logo" placeholder="请输入weixin_logo" th:value="${baseinfo?.weixin_logo}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">轮播图</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="ad" placeholder="请输入轮播图" th:value="${baseinfo?.ad}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商家图片</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="store_img" placeholder="请输入商家图片" th:value="${baseinfo?.store_img}">
            </div>
        </div>
        <div class="layui-form-item">
       <label class="layui-form-label">分类</label>
       <div class="layui-input-inline">
           <select name="storetype_id" id="storetype_id" lay-filter="storetype_id" required>
               <option value="" selected="">一级分类</option>
               <c:forEach items="${categoryCustomList}" var="c">
                   <c:if test="${c.categoryPid==0}">
                       <option value="${c.categoryId}">${c.categoryName}</option>
                   </c:if>
               </c:forEach>
           </select>
       </div>
       <div class="layui-input-inline">
           <select name="storetype2_id" id="storetype2_id">
               <option value="" selected>二级分类</option>
           </select>
       </div>
     </div>
        <div class="layui-form-item">
            <label class="layui-form-label">一级分类</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="storetype_id" placeholder="请输入一级分类" th:value="${baseinfo?.storetype_id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">二级分类</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="storetype2_id" placeholder="请输入二级分类" th:value="${baseinfo?.storetype2_id}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">入驻期限</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="store_deadline" placeholder="请输入入驻期限" th:value="${baseinfo?.store_deadline}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否置顶</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="is_top" placeholder="请输入是否置顶" th:value="${baseinfo?.is_top}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否品质商家</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="is_pz" placeholder="请输入是否品质商家" th:value="${baseinfo?.is_pz}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属城市</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="cityname" placeholder="请输入所属城市" th:value="${baseinfo?.cityname}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="num" placeholder="请输入排序" th:value="${baseinfo?.num}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">商家介绍</label>
            <div class="layui-input-inline">
                <input class="layui-input" type="text" name="details" placeholder="请输入商家介绍" th:value="${baseinfo?.details}">
            </div>
        </div>
        <div class="layui-form-item timo-finally">
            <button class="layui-btn ajax-submit"><i class="fa fa-check-circle"></i> 保存</button>
            <button class="layui-btn btn-secondary close-popup"><i class="fa fa-times-circle"></i> 关闭</button>
        </div>
    </form>
</div>
<script th:replace="/common/template :: script"></script>
<script type="text/javascript"> 
//二级联动
form.on("select(storetype_id)",function () {
    var optionstring = "";
    var cate1 = $("#storetype_id").val();
    <c:forEach items="${typeList}" var="c">
        if(cate1==${c.categoryPid}) {
            optionstring += "<option name='storetype2_id' value='${c.id}'>${c.type_name}</option>";
        }
    </c:forEach>
    $("#storetype2_id").html("  <option value=''selected>二级分类</option>"+optionstring);
    form.render('select'); //这个很重要
})
</script>
</body>
</html>